﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace OpenLightGroup.Visualizers.Controls
{
    public partial class OscilloscopeVisualizer : UserControl, IVisualizer
    {
        public OscilloscopeVisualizer()
        {
            InitializeComponent();
        }

        #region IVisualizer Members

        public void LoadParameters(params object[] values)
        {
            //not needed.
        }

        public void UpdateUI(SoundBite clip)
        {

            try
            {

                for (int i = 0; i < clip.FrequencyChannels.Count - 2; i++)
                {

                    Point newPoint = ((LineSegment)this.Figure.Segments[i]).Point;
                    newPoint.Y =  clip.FrequencyChannels[i] * -1;

                    ((LineSegment)this.Figure.Segments[i]).Point = newPoint;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }

        #endregion
    }
}
